import 'package:demo_2/pages/container.dart';
import 'package:demo_2/pages/home.dart';
import 'package:demo_2/pages/second.dart';
import 'package:demo_2/pages/text.dart';
import 'package:flutter/material.dart';

// 全局路由
class AppRouter {
  static Route<dynamic> generateRoute(RouteSettings settings) {
    switch (settings.name) {
      case '/':
        return MaterialPageRoute(builder: (_) => const HomePage());
      case '/secondPage':
        return MaterialPageRoute(builder: (_) => const SecondPage());
      case '/container':
        return MaterialPageRoute(builder: (_) => const ContainerPage());
      case '/text':
        return MaterialPageRoute(builder: (_) => const TextPage());
      default:
        return MaterialPageRoute(builder: (_) => const HomePage());
    }
  }
}
